<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-touch-fullscreen" content="yes">
    <script src="/kissy/build/seed.js" charset="utf-8"></script>
    <script src="/kissy/src/package.js"></script>
    <script src="/kissy/src/log.js"></script>
</head>
<body>

<h1>open in ios safari test rotate event</h1>

<a href="http://www.g.cn">google</a>
<button id="detach">detach</button>
<div id='t'
     style='border:1px solid green;
     width:200px;height:200px;margin:10px'>
    rotate me
</div>

<a href="http://www.g.cn">google</a>

<div style="height: 900px;"></div>
<script>
    KISSY.use('event,dom', function (S, Event) {
        var transform = S.Features.getTransformProperty();

        Event.on('#detach', 'click', function () {
            Event.detach('#t');
        });

        Event.on('#t', "rotateEnd", function (e) {
            log(e.type + ' : ' +
                    e.originalEvent.type + ' : ' +
                    e.rotation + ' : ' + e.angle);
            //S.log(e.type + ' : ' + e.rotation);
        });

        Event.on('#t', "rotate rotateStart", function (e) {
            log(e.type + ' : ' +
                    e.rotation + ' : ' + e.angle);
            //S.log(e.type + ' : ' + e.rotation);
        });
        var t = document.getElementById('t');
        var o;
        Event.on('#t', 'rotateStart', function () {
            o = 0;
            if (t.style[transform]) {
                o = parseInt(t.style[transform].replace(/rotate\(/, ''));
            }
        });
        Event.on('#t', 'rotate', function (e) {
            t.style[transform] = 'rotate(' + (o + parseInt(e.rotation)) % 360 + 'deg)';
        });

        alert('ok');
    });
</script>
</body>
</html>